<%@page import="sosr.serveur.IServeurRMI"%>
<%@page import="java.util.Iterator"%>
<%@page import="sosr.bean.Patient"%>
<%@page import="java.util.ArrayList"%>
<jsp:useBean id="logon" scope="session" class="bean.Connexion"></jsp:useBean>
<%
IServeurRMI serv = logon.getSrvRMI();
serv.open();

ArrayList<Patient> ar =  serv.listPatient();

serv.close();

int i = 0;
Iterator<Patient> it = ar.iterator();%>


<h1>Liste des patients</h1>
<%
while (it.hasNext()) { 
	i++;
	Patient p =it.next();
	String color = "#edf2ff";
	if (i%2 == 0) color = "#ffffff";
%>
<div style="background: <%=color %>; width: 100%" class="ln-rm" xrm="<%=i %>" id="ln-rm-<%=i %>" idp="<%=p.getIdPatient() %>" >
	<div onclick="setAction('view',<%=p.getIdPatient() %>,false); hilightme('ln-rm-<%=i %>','ln-rm');">
		<div><%=p.getCivilite() %></div>
		<div class="idp_name"><%=p.getNom() %></div>
		<div><%=p.getPrenom() %></div>
	</div>
	<div class="_bu" id="rm-p-<%=i %>" style="display: none">
	<div class="view_bu" title="Consulter la fiche du patient"
		onclick="setAction('view',<%=p.getIdPatient() %>,false); hilightme('ln-rm-<%=i %>','ln-rm');"></div>
	<div class="edit_bu" title="Editer la fiche du patient" 
		onclick="setAction('edit',<%=p.getIdPatient() %>,false); hilightme('ln-rm-<%=i %>','ln-rm'); hilightmenu('mb8');"></div>
	<!-- <div class="close_bu" title="Supprimer la fiche du patient"
		onclick="warn('delete',<%=p.getIdPatient() %>,'<%=p.getPrenom()+" "+p.getNom() %>',true); hilightme('ln-rm-<%=i %>','ln-rm');"></div>-->
	</div>
</div>
<%
}

%>
<script type="text/javascript">
$(".ln-rm").mouseover(function() {
	$("._bu").hide();
	var i = $(this).attr("xrm");
	$("#rm-p-"+i).show();
});
</script>